#include<bits/stdc++.h>
using namespace std;
const int NN=2e6+4;
vector<int>p[NN];
int ans[NN];
int main()
{
    freopen("mcmf.in","r",stdin);
    freopen("mcmf.out","w",stdout);
    int n,maxx=0;
    scanf("%d",&n);
    priority_queue<vector<int> >q;
    for(int i=1;i<=n;i++)
    {
        int k;
        scanf("%d",&k);
        for(int j=1;j<=k;j++)
        {
            int x;
            scanf("%d",&x);
            p[i].push_back(x);
            maxx=max(maxx,x);
        }
        reverse(p[i].begin(),p[i].end());
        q.push(p[i]);
    }
    sort(p+1,p+1+n);
    int pmax=0;
    for(int i=maxx+n;i;i--)
    {
        priority_queue<vector<int> >nq=q;
        bool flag=true;
        for(int j=i-1;nq.size();j--)
        {
            if(!j)
            {
                flag=false;
                break;
            }
            vector<int>t=nq.top();
            nq.pop();
            if(t[0]>j)
            {
                flag=false;
                break;
            }
            else if(t[0]==j)
            {
                t.erase(t.begin());
                if(t.size())
                    nq.push(t);
            }
        }
        if(!flag)
        {
            ans[i]=1;
            pmax=max(pmax,i);
            vector<int>t=q.top();
            q.pop();
            if(t[0]==i)
            {
                t.erase(t.begin());
                if(t.size())
                    q.push(t);
            }
        }
    }
    for(int i=pmax;i;i--)
        printf("%d",ans[i]);
    return 0;
}